import { ServerOptions } from "vite";
const target = 'http://192.168.0.242:8080/'
export const server: ServerOptions = {
  port: 8080,
  host: '0.0.0.0',
  proxy: {
    '/public/': {
      target: target + 'phis/',
      changeOrigin: true,
      rewrite: (path: string) => path.replace(/^\//, ''),
      bypass: (req, res) => {
        const url = req.url || ''
        res.setHeader('X-Proxy-Target', target + 'phis/' + url.replace(/^\//, ''));
      }
    },
    '^\/(?!(src|node_modules)\/)[a-zA-Z0-9]+': {
      target,
      changeOrigin: true,
      rewrite: (path: string) => path.replace(/^\//, ''),
      bypass: (req, res) => {
        const url = req.url || ''
        res.setHeader('X-Proxy-Target', target + url.replace(/^\//, ''));
      }
    },
  }
}